home *** CD-ROM | disk | FTP | other *** search
/ Kids' Bible Fun Pack / Kids' CD-ROM Bible Fun Pack (1997)(Education Publishing Concepts)[Mac-PC].iso / mac / BIBLEC / XTRAS / FileFlex Xtras / -Database Designer / 00083_Script_83 < prev    next >
Text File  |  1995-07-22  |  4KB  |  138 lines

  1. -- These routines all open and close not only the database, but
  2. -- the session as well.  Normally, you'd want to do a DBOpenSession
  3. -- at the very beginning, open all files and indexes, and close things
  4. -- up only at the very end.  But because this tool is to be used during
  5. -- unpredictable development, I wanted to make sure FileFlex wasn't 
  6. -- already active.
  7.  
  8. on doRecordScroll
  9.   global browseDBRecord, browseDBFile, dgDkBlueColor
  10.   
  11.   cursor 4
  12.   -- let's open it all up
  13.   put DBOpenSession() into DBResult
  14.   if DBResult < 0 then
  15.     cursor -1
  16.     BadOpenDatabaseAlert
  17.     exit
  18.   end if
  19.   
  20.   put DBUse(browseDBFile) into dbID
  21.   if dbID < 0 then
  22.     cursor -1
  23.     BadOpenDatabaseAlert
  24.     exit
  25.   end if
  26.   
  27.   put DBListFields() into theFields
  28.   
  29.   put EMPTY into field "masterNameList"
  30.   put EMPTY into field "masterContentList"
  31.   
  32.   delete line 1 of theFields
  33.   
  34.   put BrowseDBRecord+1 into BrowseDBRecord
  35.   
  36.   put DBGo(BrowseDBRecord) into DBResult
  37.   if DBResult < 0 then
  38.     cursor -1
  39.     BadOpenDatabaseAlert
  40.     exit
  41.   end if
  42.   
  43.   put DBGetCurrRecVal("X") into theData
  44.   delete line 1 to 2 of theData
  45.   
  46.   --
  47.   -- Parse fields from the DBListFields into our display format
  48.   -- 
  49.   repeat with i = 1 to the number of lines of theFields
  50.     if field "masterNameList" <> EMPTY then
  51.       put field "masterNameList" & RETURN into field "masterNameList"
  52.       put field "masterContentList" & RETURN into field "masterContentList"
  53.     end if
  54.     put item 1 of line i of theFields into theName
  55.     put field "masterNameList" & theName into field "masterNameList"
  56.     
  57.     put line i of theData into theLine
  58.     put item 2 of theLine into theType
  59.     delete item 1 to 2 of theLine
  60.     
  61.     if theType <> "M" then
  62.       put field "masterContentList" & string(theLine) into field "masterContentList"
  63.     else
  64.       put DBGetMemo(theName) into theMemo
  65.       put EMPTY into cleanMemo
  66.       repeat with j = 1 to the number of chars of theMemo
  67.         if char j of theMemo <> RETURN then
  68.           if charToNum(char j of theMemo) > 128 then
  69.             put cleanMemo & "." into cleanMemo
  70.           else
  71.             put cleanMemo & char j of theMemo into cleanMemo 
  72.           end if
  73.         else
  74.           put cleanMemo & " " into cleanMemo
  75.         end if
  76.       end repeat
  77.       put char 1 to 75 of cleanMemo & "..." into cleanMemo
  78.       put field "masterContentList" & cleanMemo into field "masterContentList"
  79.     end if
  80.   end repeat
  81.   
  82.   put DBCount() into maxRecord
  83.   
  84.   put DBCloseSession() into DBResult
  85.   if dbID < 0 then
  86.     cursor -1
  87.     BadOpenDatabaseAlert
  88.     exit
  89.   end if
  90.   
  91.   put 1 into topPointsToLine
  92.   doCreateScroll
  93.   
  94.   put 1 into startChar
  95.   repeat with i = the number of chars of browseDBFile down to 1
  96.     if the machineType <> 256 then
  97.       -- for mac
  98.       if char i of browseDBFile = ":" then
  99.         put i into startChar
  100.         exit repeat
  101.       end if
  102.     else
  103.       -- for mac
  104.       if char i of browseDBFile = "\" then
  105.         put i into startChar
  106.         exit repeat
  107.       end if
  108.     end if
  109.   end repeat
  110.   
  111.   if i = 1 then
  112.     put browseDBFile into shortFileName
  113.   else
  114.     put char (startChar+1) to (the number of chars of browseDBFile) of browseDBFile¼
  115.     into shortFileName
  116.   end if
  117.   
  118.   put string(browseDBRecord) & " of " & string(maxRecord) into field "browseMessage"
  119.   set the foreColor of member "browseMessage" to dgDkBlueColor
  120.   set the textSize of member "browseMessage" to 9
  121.   set the textStyle of member "browseMessage" to "bold"
  122.   set the textFont of member "browseMessage" to "Helvetica"
  123.   
  124.   if browseDBRecord = 1 then
  125.     set the castNum of sprite 14 to (the number of cast "prevDisabled")
  126.   else
  127.     set the castNum of sprite 14 to (the number of cast "prevEnabled")
  128.   end if
  129.   
  130.   if browseDBRecord = maxRecord then
  131.     set the castNum of sprite 13 to (the number of cast "nextDisabled")
  132.   else
  133.     set the castNum of sprite 13 to (the number of cast "nextEnabled")
  134.   end if
  135.   
  136.   updateStage
  137.   cursor -1
  138. end doRecordScroll